/**
 * @param {number[]} nums
 * @return {number}
 */
var minimumOperations = function (nums) {
  let count = 0,
    minNum = 0
  nums.sort((a, b) => a - b)
  let i = 0
  for (; i < nums.length; i++) {
    if (nums[i] != 0) {
      minNum = nums[i]
      if (i < nums.length) {
        for (let j = i; j < nums.length; j++) {
          nums[j] -= minNum
        }
        count++
      }
    }
  }
  return count
}
